package com.dhl.factory.simplefactory.order;

import com.dhl.factory.simplefactory.pizza.Pizza;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @title: OrderPizze01
 * @Author danghailiang
 * @Date: 2022/7/26 21:38
 * @Version 1.0
 */
public class OrderPizza01 {

    public OrderPizza01 (){
        do{
            String type = getType();
            Pizza pizza = SimpleFactory.getPizza(type);
            if(pizza != null){
                pizza.prepare();
                pizza.bake();
                pizza.box();
                pizza.cut();
            }else{
                break;
            }
        }while (true);
    }

    public String getType(){
        // 控制台获取数据
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        String type = null;
        try {
            type = bufferedReader.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return type;
    }
}
